package com.gaogzhen.datastructure.graph.undirected;

import java.util.Map;

/**
 * key-value pair 类
 * @author: Administrator
 * @createTime: 2023/03/04 21:49
 */
public final class Entry<K, V> implements Map.Entry<K, V>{

    private K key;
    private V value;

    public Entry(K key, V value) {
        this.key = key;
        this.value = value;
    }

    @Override
    public K getKey() {
        return key;
    }

    @Override
    public V getValue() {
        return value;
    }

    @Override
    public V setValue(V value) {
        V oldValue = value;
        this.value = value;
        return oldValue;
    }
}
